<template>
  <div class="flex flex-nowrap">
    <HardwareUpdate type="esl" :selected-keys="selectedKeys" />

    <a-button :disabled="selectedKeys.length == 0" @click="flashModal = true">
      {{ t["闪灯"] }}
    </a-button>

    <a-modal v-model:visible="flashModal" draggable :title="t['操作']" :footer="false">
      <FlashingLight :config="lightConfig" class="mb-2" />

      <div>
        <a-button type="primary" @click="sendLight">
          {{ t["确定"] }}
        </a-button>
      </div>
    </a-modal>
  </div>
</template>

<script setup lang="ts">
import { light } from "@/api/service/priceTag/priceTag";
import HardwareUpdate from "@/components/common/HardwareUpdate.vue";

const t = translate("公共模块");
const lightConfig = ref({
  times: 1,
  color: "1"
});
const flashModal = ref(false);
const props = defineProps<{
  selectedKeys: string[];
}>();
/**
 * 注释: 闪灯
 *
 * */
const sendLight = () => {
  light({
    ...lightConfig.value,
    tags: [...props.selectedKeys]
  });
};
</script>
